﻿<Page
	x:Class="SlotDuino.ChampionshipList"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:dal="clr-namespace:SlotDuino.DAL;assembly=SlotDuino.DAL" 
    xmlns:converter="clr-namespace:SlotDuino.Converter"
    mc:Ignorable="d" 
    Background="{x:Null}"
	Title="Gerenciamento de Campeonatos" Loaded="Page_Loaded">
    
	<Page.Resources>
        <CollectionViewSource x:Key="championshipViewSource" d:DesignSource="{d:DesignInstance dal:Championship, CreateList=True}" />
        <converter:ByteToChampionshipState x:Key="ByteToChampionshipState" />
    </Page.Resources>

	<Grid> 
		<GroupBox Header="Listagem de Campeonatos">
			<Grid>
				<StackPanel Orientation="Horizontal" Margin="0,5,0,0" VerticalAlignment="Top" d:LayoutOverrides="Width">
					<TextBox Height="32" MinWidth="343" Margin="0,0,2,0" FontSize="20" x:Name="txtSearch" />
					<Button Content="Pesquisar" Height="32" x:Name="btnSearch" Width="80" Margin="2,0" Click="btnSearch_Click" />
					<Button Content="Novo" Height="32" x:Name="btnNew" Width="80" Margin="2,0" Click="btnNew_Click" />
				</StackPanel>
                <DataGrid DataContext="{StaticResource championshipViewSource}" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding}" 
					x:Name="dgChampList" RowDetailsVisibilityMode="VisibleWhenSelected" CanUserDeleteRows="False" CanUserAddRows="False" 
					SelectionMode="Single" Background="{StaticResource SelectedBackgroundBrush}" MinHeight="400" Margin="0,42,0,47" SelectionChanged="dgChampList_SelectionChanged">
					<DataGrid.Columns>
						<DataGridTextColumn Binding="{Binding Name}" Header="Nome" IsReadOnly="True" />
						<DataGridTextColumn Binding="{Binding Path=State, Converter={StaticResource ByteToChampionshipState}}" Header="Situação" IsReadOnly="True" />
						<DataGridTextColumn Binding="{Binding Path=StartDate, StringFormat=\{0:d\}}" Header="Data Início" IsReadOnly="True" />
						<DataGridTextColumn Binding="{Binding Path=EndDate, StringFormat=\{0:d\}}" Header="Data Término" IsReadOnly="True" />
					</DataGrid.Columns>
				</DataGrid>
                <Button Content="Continuar" Height="32" x:Name="btnResume" Width="80" HorizontalAlignment="Left" Margin="0,0,0,5" VerticalAlignment="Bottom" Click="btnResume_Click" />
                <Button Content="Relatório" Height="32" x:Name="btnReport" Width="80" HorizontalAlignment="Left" Margin="84,0,0,5" VerticalAlignment="Bottom" Click="btnReport_Click" />
                <Button Content="Excluir" Height="32" x:Name="btnDelete" Width="80" HorizontalAlignment="Right" Margin="0,0,0,5" VerticalAlignment="Bottom" />
			</Grid>
		</GroupBox>
	</Grid>
</Page>